<?php

namespace App\Admin\Controllers;

use App\Http\Controllers\Controller;
use App\Models\Arenacontest;
use App\Models\ArenacontestUser;
use App\Models\CityList;
use App\Models\Sect;
use Encore\Admin\Controllers\HasResourceActions;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Layout\Content;
use Encore\Admin\Show;
use App\Models\WechatUser;

class SectsController extends Controller
{
    use HasResourceActions;

    private $name = '球馆信息';

    /**
     * Index interface.
     *
     * @param Content $content
     * @return Content
     */
    public function index(Content $content)
    {
        return $content
            ->header($this->name)
            ->description(trans('admin.list'))
            ->body($this->grid());
    }


    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new Sect);
        $grid->disableCreateButton();
        //禁用行选择checkbox
        $grid->disableRowSelector();
        //禁用行操作列
        $grid->disableActions();
        //禁用行选择器
        $grid->disableColumnSelector();
        //设置分页选择器选项
        $grid->filter(function ($filter) {
            // 去掉默认的id过滤器
            $filter->disableIdFilter();
            // 在这里添加字段过滤器
            $filter->like('name', '球馆名称');
            $filter->like('tele', '联系电话');
        });
        $grid->cityInfo()->name('城市');
        $grid->name('球馆名称');
        $grid->point('活跃值');
        $grid->score('积分');
        $grid->address('地址');
        $grid->tele('联系电话');
        $grid->charge('收费标准');
        $grid->opentime('营业时间');
        $grid->created_at('创建时间');
        $grid->model()->orderBy('id', 'desc');
        return $grid;
    }


}
